#!/usr/bin/env python
# -*- coding: utf-8 -*-


from potherb.help import bisectLeft,bisectRight, insort

#######################################################################

def test1() :
    haystack = []
    for needle in (4,7,5,8,3) :
        insort(haystack, needle)
    print haystack

    for needle in (9, 6, 3, 1) :
        index = bisectLeft(haystack, needle)
        print 'haystack %s BisectLeft  needle %d at %d' % (haystack, needle, index)
    for needle in (9, 6, 3, 1) :
        index = bisectRight(haystack, needle)
        print 'haystack %s BisectRight needle %d at %d' % (haystack, needle, index)
    # test1()

def test2() :
    haystack = []
    for needle in (r'\x00','00','\x00') :
        insort(haystack, needle)
    print haystack
    # test2()

#######################################################################

if  __name__ == '__main__' :
    test1()
    test2()

